package com.ogawa.project6602.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.ogawa.base.utils.imageloader.ImageConfigImpl
import com.ogawa.base.utils.imageloader.ImageLoader
import com.ogawa.project6602.R
import com.ogawa.project6602.activity.MUSIC_STATUS_WAIT_DOWN
import com.ogawa.project6602.bean.MusicResponse

class MusicHunYinListAdapter :
    BaseQuickAdapter<MusicResponse, BaseViewHolder>(R.layout.item_music_hunyin) {
    override fun convert(helper: BaseViewHolder, item: MusicResponse?) {
        item?.let {
            helper.setText(R.id.titleTv, it.name)
            var musicStatusIv = helper.getView<ImageView>(R.id.Iv)
            if (it.status == MUSIC_STATUS_WAIT_DOWN) {
                ImageLoader.getInstance().loadImage(
                    mContext, ImageConfigImpl.builder()
//                        .isCenterCrop(true)
                        .url(it.notDownIcon)
                        .imageView(musicStatusIv)
                        .build())
            } else {
                ImageLoader.getInstance().loadImage(
                    mContext, ImageConfigImpl.builder()
//                        .isCenterCrop(true)
                        .url(it.downIcon)
                        .imageView(musicStatusIv)
                        .build())
            }
        }

    }
}